home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Graphics Plus
/
Graphics Plus.iso
/
msdos
/
raytrace
/
pov
/
gen
/
rayscene
/
rayscene.doc
< prev
next >
Wrap
Text File
|
1991-12-12
|
14KB
|
331 lines
Rayscene - Ray Tracer Scene Generator, Version 1.33
===================================================
This is Rayscene, small, but very useful utility for raytracer users.
Rayscene is designed to take advantage of raytracers when creating ani-
mation scenes. It's machine independent and it doesn't care, which ray-
tracer you are using. It's very easy to configure to meet your needs.
1. INTRODUCTION
Smooth animation is not very easy to create with raytracers, if you are
using PD-software like DKB,QRT,VORT,DBW etc...For example, you want to
create animation scene where camera moves round some object. Take out your
calculator and calculate values, then create 500 data-files, and finally
insert values. Then create script, which renders all pictures. After ren-
dering, change pictureformat to another format. What a waste of time.
Rayscene offers good solution to problem. Lets do that animation again
with Rayscene. You want to change coordinates of view_point so that ca-
mera circles around your object:
1. Replace values with variable-names:
VIEW_POINT <0.0 0.0 0.0>
-> VIEW_POINT <#xcoordinate# #this is ycoordinate# #z#>
2. Create a little program, which outputs values of sin/cos and redirect
them to file. Let's suppose, "range" is a name of a program, which out-
puts values of sin/cos:
range > array.arr
3. Edit array.arr. Insert variable names:
1.324 2.234 #this is comment# 3.345 4.336 4.456 ....
-> xcoordinate/this is ycoordinate/z,5
1.324 2.234 #this is comment# 3.345 4.336 4.456 ....
4. Write a little script, which calculates one picture. After that, chan-
ge picture format:
dkbtrace +q9 +a +t +i#.dat +o#.tga
tga2ppm <#.tga | ppmquant 256 |ppmtogif > #.gif
5. Use rayscene to create five hundred scenes.
rayscene -ddata -aarray -c500 -sscript
What happens? Rayscene replaces all variable names with values and
then creates 500 data-files. After that it invokes ScriptGenerator,
which creates new script, which consists:
dkbtrace +q9 +a +t +idatax.dat +odatax.tga
tga2fbm <datax.tga | fbquant 256 |fbmtogif > datax.gif
dkbtrace +9 ....
where x is current scene-number (1-500). After that, just start script
or bat, and rendering and format-changing is done automatically.
Result is animation (500 pictures), where camera moves smoothly using
sin/cos values. Notice, that you can use same variables for example to
move object when same values are used to move camera.
NOTICE: All marks # / etc are easy to change, if you want to use other marks.
2. CONFIGURATION
Rayscene should be very easy to configure. Just edit rayscene.h and re-
place default values. After that compile source files again. Makefiles
for Unix, Microsoft C and Amiga are included.
3. OPTIONS
Rayscene (current version) has following options (options may begin with
- or / or + or whatever letter...also letters may be upper or lowercase).
Options and short help are displayed if you write only "rayscene" without
any parameters.
-Dname Input data-name and no extension. Extension is defined in rayscene.h
Edit it if you want to change default extension and compile rayscene
again.
-Aname Input array-name. Rayscene tries to find varible-values from that
file. Default name is "array" ( so, use only "-a"), if you want to
change it, edit rayscene.h and compile rayscene again.
-Ccount Number of scenes to create. There is no default value for that.
-Sname Script-name for ScriptGenerator. If you don't give name, you can
type your own script. Generator invokes editor, which is by default
"me" (MicroEmacs). Edit your script, and save it. Generator reads
script-file, and replaces all '#'s (defined in rayscene.h) with
current file_name.
-Iname This option ensures, that comments in your data file do not effect
to Rayscene. Name is raytracer name. This option effects only, if
you have variable names inside comments. For example:
{ #Ping# was here before #Pong# }
Rayscene gives error message, if you have values only for Pong. If
you define /Idkb, comments are skipped. Now supporting DKB,VORT,QRT.
-Nx Type of output-names. For example Autodesk Animator provides very
easy way of loading files, when they end with numbers. Types are:
/NA -> if count is 100, first name is data001.dat, last data100
/NN -> if count is 100, first name is data1.dat, last data100
Default is /NN.
NOTICE:Make sure, that last letter of original data_file_name is
not number.
-Oname If you want different name to your data-files, use this option.
This option defines new output name for scene-files. Extension is
defined in rayscene.h, if you want to change it, edit rayscene.h
and compile rayscene again.
-Uname If datafile, arrayfile and outpufile have same name, use this option.
"Rayscene -utest -c20"
is synonyme to
"Rayscene -atest -dtest -otest -c20".
This option does not change script's filename. You can still cheat
a bit:
"Rayscene -utest -oshadow -c20"
is synonyme to
"Rayscene -atest -dtest -oshadow -c20"
-Rx,x1 Create only requested scenes. For example /r1,5 would create only
scenes 1-5. Overrides -C option.
4. ARRAY-FILE
Array file includes values for variables. Rayscene scans through this
file, reads values for all used variables and replaces data file's
variable names with their values when generating new data/scene files.
Array file can include data for more variables than is actually used,
only those that are referenced in data file are read into memory.
The sequence of variables in array file is not important.
Each variable can have more values than is used. Rayscene uses the
first values and skips those that are not needed. The format of an
array file is quite free: extra white space is allowed in most places
and comments can be included if needed.
File consists of variable groups. Group consists of group header
followed by the values of group's variables. There can be one or several
variables in a group. Below is a short example of an array file:
-----------------------------------------------------------------------
Var1/Var2/Var3/LastVariable,3 # <-- This is the header part.
Variable names of a group are
separated by a '/'. After the last
variable name there must be a ','
followed by the number of values
for each variable.
#
1 2 3 4 # first values for each variable #
5 6
7.0 8.0 # second values #
9 10 11 12 # third values #
Variable5,10
1 2 3 #<- 3rd value # 4 5 6 7 8 9 10 # these are the values for
Variable5
#
-----------------------------------------------------------------------
A comment starts with a '#' and ends when another one is encountered.
It can be as long as you wish. You can have comments between group
header and it's values. Also, there can be comments between values
with different index. What does that mean? To illustrate this, see
the example above:
In the first group, there can be comments between numbers 4 and 5
because 4 = LastVariable[1] and 5 = Var1[2]. There can't be a comment
between numbers 3 and 4 because 3 = Var3[1] (Variable indexes are the
same). Did you understand? I hope so.. ;)
Variable names can be up to 40 characters by default. Should you need
longer names, just change MAX_VAR_LENGTH in rayscene.h and recompile.
Names aren't case sensitive.
5. DATA-FILE
Rayscene is used to replace values from ascii-data file. As mentioned
before, all variable_names will be replaced (except if /I-option is
used).
Version 1.33 has opne new feature which lets you make simple calcula-
tions before replace. You can use -+/* to change replaced value.
VIEWPOINT < 0 #y-axis#+100 0 > (y-axis+100)
VIEWPOINT < 0 #y-axis#-100 0 > (y-axis-100)
VIEWPOINT < 0 #y-axis#*100 0 > (y-axis*100)
VIEWPOINT < 0 #y-axis#/100 0 > (y-axis/100)
NOTICE: No blanks between #+100 ! Do not use "# + 100"!
6. SCRIPTS
When you start rendering your pictures, you can use script making all
commands for you. But if you just created 500 scene, who's gonna write
that script?
Rayscene has one neat feature, called ScriptGenerator. Use it to make
a dirty work for you. For example, you want to create a script, which
renders picture, then changes it's format and finally, adds it to zoo
archive:
dkbtrace +w640 +h480 +q9 +a +t -v +itest.dat +otest.tga
tga2fbm <test.tga | fbquant -c256 -G >test.gif
zoo a test.zoo test.gif
That might do it? Sure, but you still have 499 scenes to go...
Ok, let's use ScriptGenerator. Before you launch rayscene, create
that script as:
dkbtrace +w640 +h480 +q9 +a +t -v +i#.dat +o#.tga
tga2fbm <#.tga | fbquant -c256 -G >#.gif
zoo a test.zoo #.gif
Save your script to file "testscr.bat" (for example), and launch
Rayscene with command
"rayscene -dtest -avalues -c500 -stestscr"
*OR*
You can use one little shortcut. Give command
"rayscene -dtest -avalues -c500 -s"
After creating 500 scripts, Rayscene will open your editor to create that
script. Save it, and Rayscene replaces all #-marks with current file_name.
After rayscene you will have file testscr.new, which will consist 500
duplicates of your script. #-marks are replaced by current file_name.
7. NOTES,HINTS
Written in C, should be portable very easily to every environment. Be-
fore compiling, edit rayscene.h to meet your needs (variable length,
default filenames/extensions...etc). When compiling, define environment
ie -DIBMPC, -DUNIX and -DAMIGA..etc (if not using included makefiles).
If you define file_name_length 8 (as it is in PC), and create 100 scenes
with name "testing", name is cut ie. 10th output-name is testin10, or if
you have defined /NA, testi010.
8. EXAMPLES
rayscene -ainput -dvalues -c200 -s -na
- Get raytracer-data from input.dat and values from values.arr. Create
200 scenes and use editor to create script. First scene name is
input001.dat. Without -na it would be input1.dat.
rayscene -utest -c20
- Use name "test" for datafile, arrayfile and outputfile. Create 20 scenes
rayscene -utest -c20 -scalc
- Same as above, but use old script "calc" to create new script. More
about scripts in Chapter 5.
rayscene -d -a -c120
- Use default names (defined in rayscene.h) and create 120 scenes.
9. FUTURE
If you liked or are going to use Rayscene, please register. That DOES
NOT mean, you have to send us money (who would send us 20 finnish marks??),
but it ensures that you get the next version ( or information about it).
Also comments and suggestions for future versions are always welcome! If
you have something in our mind, send your idea or your code to us...
Registration form is very simple.
------------------------------------------------------------------------------
Name:
Company:
Street address:
City/Code/Country:
Machine/operating system/purpose of using/what raytracer,...etc:
Comments, future enhancements:
-------------------------------------------------------------------------------
Mail Your form to:
Hole@rieska.oulu.fi or
Oldfox@rieska.oulu.fi
COPYRIGHT: Still, this is our code! That does not mean, it's piece of art. But
it means, we have made it. This code is not for commercial use. You
are encouraged to give it to your friends, but not to take any money.
If you would like to change it, change it, but leave our names to
source code, and put your name and little description under subject
HISTORY. Also, if you add some neat new features, inform US, so we
could put it to next version. Enjoy...
BUGS: Don't end your original data_file_name with number. For example, if
you have name "simple1.dat", and max_name_length is 8
-> The first output_name is simple11.dat and 11th is simple11.dat
(because Rayscene cuts filename if it is longer than max_file_name)
Jari Kähkönen (PC) Panu Hassi (AMIGA)
Hole@tolsun.oulu.fi Oldfox@tolsun.oulu.fi